package com.zj.small.controller;

import com.zj.small.pojo.Information;
import com.zj.small.pojo.Result;
import com.zj.small.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class InformationController {
    @Autowired
    private InformationService informationService;
    @PostMapping("/chat")
    public Result chat(@RequestBody Information information) {
        System.out.println(information.getChat_text());
        System.out.println(information.getUser_text());
        System.out.println(information.getData_id());

        // 写入数据库
        informationService.addInformation(information);
        // TODO: 调用接口获取聊天信息
        return Result.success();
    }

}
